<!DOCTYPE html>
<html>
	<head> 
		<meta charset="UTF-8">
		<title>朋友圈文库</title>
		 <link rel="stylesheet" href="css/lib/bootstrap.min.css" />
	    <script src="js/jquery.min.js"></script>
	    <script src="js/lib/bootstrap.min.js"></script>
	   <!--  <script src="js/lib/vue.min.js"></script>
	   <script src="js/lib/vue-resource.js"></script> -->
	   <script src="./js/lib/angular.min.js"></script>
	   <script src="js/base.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<style>
		body{
			font-size:12px;
		}
		/* table,
		th,
		td {
			border: 1px solid #ccc;
			border-collapse: collapse;
			padding: 5px;
			vertical-align: middle !important;
		}		
		table td:nth-child(odd) {
			background-color: #f1f1f1;
			width:160px;
		}
		table td:nth-child(even) {
			width:160px;
		}
		table tr:nth-child(even) {
			background-color:#ffffff;
		} */
		input{
			width:280px;
		}
		span{
			width:20px;color:red;display:inline-block;text-align:center;
		}
		#sho{
			width:300px;
			height:50px;
			background:#d9534f;
			opacity:0.8;
			border-radius:8px;
			color:#fff;
			text-align: center;
			font-size:30px;
			position: absolute;
			top:0px;
			left:550px;
			display:none;
		}
		img{
			margin:10px 2px 10px;
			width:70px;
			/*height:150px;*/
			border-radius:5px;
			box-shadow:2px 3px 5px;
			transition:.5s all;			
		}

		/* img:hover{
			transform:scale(6);
		} */
	</style>
	<body ng-app="myApp" ng-controller="customersCtrl">		
		<div class="">
			<div id="sho"></div>
		<div style="width:99%;margin:0 auto;padding:15px 5px 0px 5px;border:1px solid #ccc;margin-bottom:15px">	   		
			<table class="table table-hover" style="width:50%;margin:0 auto;">				
				<tbody>
					<tr>
						<th colspan="8" style="background:#ccc">朋友圈文库预览:</th>
					</tr>
					<tr class="text-center" style="font-weight:800;background:#ccc">
						<td>上传日期</td>
						<!-- <td>品牌</td>
						<td>编号</td> -->
						<!-- <td>文章标题</td> -->
						<td>文库内容</td>	
						<!-- <td class="text-left">推广图片</td> -->
						<!-- <td>备注</td> -->
						
						<td>操作</td>																				
					</tr>
					<tr class="text-center" ng-repeat="i in list">
					    <td>{{i.update_time | date:"yyyy/MM/dd h:mma":"UTC"}}</td>
		                <!-- <td>{{i.brand_id}}</td>
		                <td>{{i.id}}</td> -->
		                <!-- <td></td> -->
		                <td class="text-left">
		                	<div style="font-weight:600;color:#666;margin-bottom:20px;">{{i.title}}<p ng-if="i.title==''">无题</p></div>
		                    {{i.content}}
							<div>
								<img src="{{i.img_url[0]}}" alt="暂无图片"><img src="{{i.img_url[1]}}" alt="暂无图片"><img src="{{i.img_url[2]}}" alt="暂无图片"><img src="{{i.img_url[3]}}" alt="暂无图片">
							</div>
		                </td>	
						<!-- <td class="text-left"></td> -->
					<!-- 	<td class="text-left">
					<p>1：{{i.remarks}}</p>
					<p>2：{{i.remarks1}}</p></td> -->
						
						<td>
							<button class="btn btn-danger" data-toggle="modal" data-target="#dle" ng-click="add(i)">删除</button>
						</td>																		
					</tr>
					<tr>
						<td colspan="8" class="text-center" ng-show="list.length==0">暂无数据</td>
					</tr>					
				</tbody>
			</table>
		</div>
			 <div class="modal fade" role="dialog" id="dle">
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header">
								<button class="close" data-dismiss="modal">
									<span class="">&times;</span>
								</button>
								<h4 class="modal-title">删除朋友圈推广文章？</h4>
							</div>
							<div class="modal-body text-right">								
								<button class="btn btn-primary" data-dismiss="modal" ng-click="del()">确认</button>
								<button class="btn btn-danger" data-dismiss="modal">取消</button> 
							</div>
						</div>
					</div>
				</div> 
		<div style="height:500px;"></div>
		</div>
	</body>
	<script>
		var app = angular.module('myApp', []);
		app.controller('customersCtrl', function($scope, $http ){ 
			var xx = sessionStorage.getItem(key = 3);
			var data = {brand_id:xx}
                   console.log(data);
                   $http({
                   method: 'POST',
                   params:data,
                   url: window.baseUrl+'user/app/imagetext/query/brandid'
                   }).then(function successCallback(data){
                           console.log("请求所有数据成功...")
                           console.log(data.data.result)
                           $scope.list = data.data.result
                   }, function errorCallback(data){
                           console.log("请求数据失败...")
                           alert("网络错误，请重试")
                   });
                   $scope.add = function(i){
                   		console.log(i.id);
                   		sessionStorage.setItem(98,i.id);
                   }
                   $scope.del = function(){
                   		var x = sessionStorage.getItem(98);
						var data = {
							id:x
						}
						console.log(data)
	           			 $http({
		                   method:'POST',
		                   params:data,
		                   url:window.baseUrl+'user/app/imagetext/delect/id'
		                   }).then(function successCallback(data){
		                           console.log(data);
		                           window.location.href="文库预览.html"		                          
		                   }, function errorCallback(data){
		                           console.log(data)
		                           alert("网络错误，请重试")
		                   });
                   }

		})
	</script>
	<script>
			/*$(function(){
				new Vue({
					el:"body",
					data:{
						list:[]
					},
					created:function(){
						alert("加载中！")
						this.$http.post(window.baseUrl+"user/app/slideshow/query/brandid",{brand_id:2},{emulateJSON:true}).then(
		 						   function (res) { 
		 						    console.log(res);
		 						    this.list = res.data.result;
								    console.log(this.list)
		 						   },function (res) {
		 						   		alert("网络断开！请检查网络") 									   						 
								   } 
		 						  );
			 			
					}
				})
			})*/
		
	</script>
</html>




